package org.ww.oss.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.ww.commonutils.R;
import org.ww.oss.service.OssService;

@RestController
@RequestMapping("/oss/fileoss")
//@CrossOrigin
public class OssController {
    @Autowired
    private OssService ossService;

    @PostMapping
    public R uploadFileAvatar(MultipartFile file){
        //上传头像到oss中
        String url=ossService.uploadFile(file);
        return R.ok().data("url",url);
    }
}
